package com.print;

import java.io.FileOutputStream;
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.List;

import javax.swing.JApplet;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.codehaus.jackson.map.ObjectMapper;

import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import com.model.fx.PrintFX016;
import com.model.fx.PrintFX017;
import com.model.fx.PrintFXBLJL;
import com.model.fx.PrintFXBSD;
import com.model.fx.PrintFXLL;
import com.model.fx.PrintFXSK;
import com.model.fx.PrintFXYZ;
import com.sun.xml.internal.fastinfoset.stax.events.Util;
import com.util.JackUtil;
/**
 * FX客户端标签打印
 * 
 * @author 
 * 
 */
public class LabelApplet4FX extends JApplet {

	private static final long serialVersionUID = -6391368515081034834L;
	public void PrintJX(final String customer_id,final String mode_id,final String date,final String prd_spec,
			final String wo_id,final String woCnt,final String jsonCntAry,final String boxRule,final String totalCnt,
			final String jsonAry,final String layout_cnt) {
		ObjectMapper mapper = new ObjectMapper();
		String[] ja = null;
		String[]jaCnt = null;
		int loopCnt;
		int li;
		int index;
		try {
			ja = mapper.readValue(jsonAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}
		try {
			jaCnt = mapper.readValue(jsonCntAry, String[].class);
		} catch (Exception e) { 
			System.out.println("Error took place");
			e.printStackTrace();
		}
		System.out.println("Start");
		double len = ja.length;
		System.out.println(len);
		
		loopCnt = (int)Math.ceil(len/12);
		System.out.println(Math.ceil(len/12));
		System.out.println(len/12);
		System.out.println(loopCnt);
		
		for(li=0;li<loopCnt;li++){
			LabelJX label = new LabelJX(212, 290, 300);
			int j=0;
			int k=0;
			int lj=0;
			double step = 5.5;
			double _y = 8;
			double _yy = 15.2;
			for(lj=0;lj<12;lj++){
				index = li*12+lj;
				if( index >= ja.length){
					break;
				}
				j = lj%3;
				/**
				 * 横坐标值
				 */
				double x1 = 3.8 + 69*j;
				double x2 = 30.8 + 69*j;
				double x3 = 2 + 69*j;
				double x4 = 23 + 69*j;
				double x6 = 29.8 + 69*j;
				/**
				 * 纵坐标值
				 */
				k = lj/3;
				double y1= 9.5 + k*72 ;
				double y2 = 7.8 + k*72 ;
				double y3 = _y + 72*k + step;
				double y4 = _y + 72*k + 2*step;
				double y5 = _y + 72*k + 3*step;
				double y6 = _y + 72*k + 4*step;
				double y7 = _y + 72*k + 5*step;
				double y8 = _y + 72*k + 6*step;
				double y9 = _y + 72*k + 7*step;
				double yA = _y + 72*k + 8*step;
				double yB = 4.3  + k*72;
				double yD = 55.2 + k*72;
				/**
				 * Line的纵坐标值
				 */
				double _yy1 = _yy + k*72 ;
				double _yy2 = _yy + k*72 + step;
				double _yy3 = _yy + k*72 + 2*step;
				double _yy4 = _yy + k*72 + 3*step;
				double _yy5 = _yy + k*72 + 4*step;
				double _yy6 = _yy + k*72 + 5*step;
				double _yy7 = _yy + k*72 + 6*step;
				double _yy8 = _yy + k*72 + 7*step;
				
				label.addRectangle(new Rectangle(x3, y1, 67, 55.5, 0.2));
				label.addLine(new Line(x4,y1,44,0.2,-90));
				
				label.addText(new Text(x1, yB, "宋体", 2, 14, "方兴科技"));
				label.addText(new Text(x6, y2, "宋体", 0, 14, "原料来料标签"));
				
				label.addText(new Text(x1, y3, "宋体", 0, 12, "客户代码"));
				label.addText(new Text(x2, y3, "Arial", 0, 12, customer_id));
				label.addLine(new Line(x3,_yy1,67,0.2,0));
				
				label.addText(new Text(x1, y4, "宋体", 0, 12, "客户型号"));
				label.addText(new Text(x2, y4, "宋体", 0, 12, mode_id+"("+layout_cnt+"模)"));
				label.addLine(new Line(x3,_yy2,67,0.2,0));
				
				label.addText(new Text(x1, y5, "宋体", 0, 12, "来料日期"));
				label.addText(new Text(x2, y5, "Arial", 0, 12, date));
				label.addLine(new Line(x3,_yy3,67,0.2,0));
				
				label.addText(new Text(x1, y6, "宋体", 0, 12, "规格"));
				label.addText(new Text(x2, y6, "Arial", 0, 12, prd_spec));
				label.addLine(new Line(x3,_yy4,67,0.2,0));
				
				label.addText(new Text(x1, y7, "宋体", 0, 12, "生产订单号"));
				label.addText(new Text(x2, y7, "Arial", 0, 12, wo_id));
				label.addLine(new Line(x3,_yy5,67,0.2,0));
				
				label.addText(new Text(x1, y8, "宋体", 0, 12, "订单数量"));
				label.addText(new Text(x2, y8, "Arial", 0, 12, woCnt));
				label.addLine(new Line(x3,_yy6,67,0.2,0));
				
				label.addText(new Text(x1, y9, "宋体", 0, 12, "本箱数量"));
				label.addText(new Text(x2, y9, "Arial", 0, 12, jaCnt[index]));
				label.addLine(new Line(x3,_yy7,67,0.2,0));
				
				label.addText(new Text(x1, yA, "宋体", 0, 12, "箱号"));
				label.addText(new Text(x2, yA, "Arial", 0, 12, (Integer.parseInt(boxRule)+index)+" / "+ totalCnt));
				label.addLine(new Line(x3,_yy8,67,0.2,0));
				
				Code code = new Code( x1, yD, 10, 0.20, ja[index]);
				try {
					label.addCode128(code);
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			try {
				label.print();
			} catch (Exception e) {
				e.printStackTrace();
			}
			label.dispose();
		}
	}
	
	public void PrintJX4BS(final String customer_id,final String mode_id,final String date,final String prd_spec,
			final String wo_id,final String woCnt,final String jsonCntAry,final String boxRule,final String totalCnt,
			final String jsonAry,final String layout_cnt,final String mtrl_id,final String habk_id) {
		ObjectMapper mapper = new ObjectMapper();
		String[] ja = null;
		String[]jaCnt = null;
		int loopCnt;
		int li;
		int index;
		try {
			ja = mapper.readValue(jsonAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}
		try {
			jaCnt = mapper.readValue(jsonCntAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}
		System.out.println("Start");
		double len = ja.length;
		System.out.println(len);
		
		loopCnt = (int)Math.ceil(len/12);
		System.out.println(Math.ceil(len/12));
		System.out.println(len/12);
		System.out.println(loopCnt);
		
		for(li=0;li<loopCnt;li++){
			LabelJX label = new LabelJX(212, 290, 300);
			int j=0;
			int k=0;
			int lj=0;
			double step = 5.3;
			double _y = 6.5;
			double _yy = 13.7;
			double Max_y=72.5;
			for(lj=0;lj<12;lj++){
				index = li*12+lj;
				if( index >= ja.length){
					break;
				}
				j = lj%3;
				/**
				 * 横坐标值
				 */
				double x1 = 3.8 + 69*j;
				double x2 = 30.8 + 69*j;
				double x3 = 2 + 69*j;
				double x4 = 23 + 69*j;
				double x6 = 29.8 + 69*j;
				/**
				 * 纵坐标值
				 */
				k = lj/3;
				double y1= 8 + k*Max_y ;
				double y2 = 6.8 + k*Max_y ;
				double y3 = _y + Max_y*k + step;
				double y4 = _y + Max_y*k + 2*step;
				double y5 = _y + Max_y*k + 3*step;
				double y6 = _y + Max_y*k + 4*step;
				double y7 = _y + Max_y*k + 5*step;
				double y8 = _y + Max_y*k + 6*step;
				double y9 = _y + Max_y*k + 7*step;
				double ya = _y + Max_y*k + 8*step;
				double yb = _y + Max_y*k + 9*step;
				double yA = _y + Max_y*k + 10*step;
				double yB = 5.3  + k*Max_y;
				double yC = 62.7 + k*Max_y;
				/**
				 * Line的纵坐标值
				 */
				double _yy1 = _yy + k*Max_y ;
				double _yy2 = _yy + k*Max_y + step;
				double _yy3 = _yy + k*Max_y + 2*step;
				double _yy4 = _yy + k*Max_y + 3*step;
				double _yy5 = _yy + k*Max_y + 4*step;
				double _yy6 = _yy + k*Max_y + 5*step;
				double _yy7 = _yy + k*Max_y + 6*step;
				double _yy8 = _yy + k*Max_y + 7*step;
				double _yy9 = _yy + k*Max_y + 8*step;
				double _yy0 = _yy + k*Max_y + 9*step;
				
				label.addRectangle(new Rectangle(x3, y1, 67, 64.2, 0.2));
				label.addLine(new Line(x4,y1,53.6,0.2,-90));
				
				label.addText(new Text(x1, yB, "宋体", 2, 14, "方兴科技"));
				label.addText(new Text(x6, y2, "宋体", 0, 14, "原料来料标签"));
				
				label.addText(new Text(x1, y3, "宋体", 0, 12, "客户代码"));
				label.addText(new Text(x2, y3, "Arial", 0, 12, customer_id));
				label.addLine(new Line(x3,_yy1,67,0.2,0));
				
				label.addText(new Text(x1, y4, "宋体", 0, 12, "客户型号"));
				label.addText(new Text(x2, y4, "宋体", 0, 12, mode_id+"("+layout_cnt+"模)"));
				label.addLine(new Line(x3,_yy2,67,0.2,0));
				
				label.addText(new Text(x1, y5, "宋体", 0, 12, "料号"));
				label.addText(new Text(x2, y5, "宋体", 0, 12, mtrl_id));
				label.addLine(new Line(x3,_yy3,67,0.2,0));
				
				label.addText(new Text(x1, y6, "宋体", 0, 12, "手册号"));
				label.addText(new Text(x2, y6, "宋体", 0, 12, habk_id));
				label.addLine(new Line(x3,_yy4,67,0.2,0));
				
				label.addText(new Text(x1, y7, "宋体", 0, 12, "来料日期"));
				label.addText(new Text(x2, y7, "Arial", 0, 12, date));
				label.addLine(new Line(x3,_yy5,67,0.2,0));
				
				label.addText(new Text(x1, y8, "宋体", 0, 12, "规格"));
				label.addText(new Text(x2, y8, "Arial", 0, 12, prd_spec));
				label.addLine(new Line(x3,_yy6,67,0.2,0));
				
				label.addText(new Text(x1, y9, "宋体", 0, 12, "生产订单号"));
				label.addText(new Text(x2, y9, "Arial", 0, 12, wo_id));
				label.addLine(new Line(x3,_yy7,67,0.2,0));
				
				label.addText(new Text(x1, ya, "宋体", 0, 12, "订单数量"));
				label.addText(new Text(x2, ya, "Arial", 0, 12, woCnt));
				label.addLine(new Line(x3,_yy8,67,0.2,0));
				
				label.addText(new Text(x1, yb, "宋体", 0, 12, "本箱数量"));
				label.addText(new Text(x2, yb, "Arial", 0, 12, jaCnt[index]));
				label.addLine(new Line(x3,_yy9,67,0.2,0));
				
				label.addText(new Text(x1, yA, "宋体", 0, 12, "箱号"));
				label.addText(new Text(x2, yA, "Arial", 0, 12, (Integer.parseInt(boxRule)+index)+" / "+ totalCnt));
				label.addLine(new Line(x3,_yy0,67,0.2,0));
				
				Code code = new Code( x1, yC, 9, 0.20, ja[index]);
				try {
					label.addCode128(code);
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			try {
				label.print();
			} catch (Exception e) {
				e.printStackTrace();
			}
			label.dispose();
		}
	}
	
	public void PrintBacth(final String batch_id){
		LabelJX label = new LabelJX(100, 100, 300);
		Code code = new Code( 4, 3, 12, 0.3, batch_id);
		try {
			label.addCode128(code);
		} catch (IOException e) {
			e.printStackTrace();
		}
		try {
			System.out.println("before");
			label.print();
			System.out.println("after");
		} catch (Exception e) {
			e.printStackTrace();
		}
		label.dispose();
	}
	
	public void PrintJDF(final String name,final String boxID,final String customer_name,final String modelName,
			final String pnlCnt,final String shtCnt,final String totalCnt,final String date,final String productSpec,
			final String lotNo,final String jsonAry,final String productCate) {
		ObjectMapper mapper = new ObjectMapper();
		String[] ja = null;
		try {
			ja = mapper.readValue(jsonAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}
		Label label = new Label(100, 100, 300);
		label.addRectangle(new Rectangle(1, 1, 98, 97, 0.2));
		label.addText(new Text(5.8, 6.1, "宋体", 0, 18, name));
		label.addText(new Text(72.8, 6.1, "Arial", 0, 13, "ROHS"));
		label.addText(new Text(5.8, 10.1, "宋体", 0, 13, "Client Name: "
			+ customer_name));
		label.addText(new Text(5.8, 13.6, "Arial", 0, 13, "Model:  "
			+ modelName));
		label.addText(new Text(53.2, 13.6, "Arial", 0, 13, "Q'TY(Q) :"
			+ shtCnt));
		label.addText(new Text(5.8, 17.1, "Arial", 0, 13, "Date:  "
			+ date));
		label.addText(new Text(53.2, 17.1, "Arial", 0, 13, "Q'TY(S) :"
			+ totalCnt));
		label.addText(new Text(5.8, 20.6, "Arial", 0, 13, "Size:  "
			+ productSpec));
		label.addText(new Text(53.2, 20.6, "Arial", 0, 13, "Lot No  :"
			+ lotNo));
		label.addText(new Text(5.8, 23.9, "Arial", 0, 13, "Order No:  "));
		label.addText(new Text(53.2, 23.9, "宋体", 0, 13, "Product Cate:"
			+ "正常品"));
		Text text = new Text(5.8, 27.5, "Arial Black", 0, 15, boxID);
		label.addText(text);
		Code code = new Code(5.8, 28.5, 8, 0.25, boxID);
		
		try {
			label.addCode128(code);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (ja == null) {
			System.out.println("Sheet array is empty");
		} else {
			double x1 = 5.8;
			double x2 = 36.8;
			double x3 = 67.8;
			double y = 39.8;
			double step = 3.5;
			for (int i = 0; i < ja.length; i++) {
				double x = 0;
				if (i % 3 == 0) {
					x = x1;
				} else if ( i % 3 == 1){
					x = x2;
				}else{
					x = x3;
				}
				double _y =  y + (i/3)*step;
				label.addText(new Text(x, _y, "Arial", 0, 12, ja[i]));
			}
		}
		try {
			label.print();
		} catch (Exception e) {
			e.printStackTrace();
		}
		label.dispose();
	}
	// 016客户标签
	public void PrintFor016(final String printer, final String boxId , final String cusId, final String mdlId, final String mtrlId
			, final String qty, final String lyDate, final String note, final String soId, final String wywoId, final String lotId
			, final String usrId, final String jyDate) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct34");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct34", printer, boxId, cusId, mdlId, mtrlId, qty, lyDate, note, soId, wywoId, lotId, usrId,jyDate);

				return null;
			}
		});
	}
	// 030客户标签
	public void PrintFor030(final String printer,final String mdlid, final String date,
			final String boxid, final String cnt, final String mtrl,final String grade) {
		System.out.println("Start");
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct4");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct4",printer, mdlid, date, boxid, cnt,
							mtrl, grade);

				return null;
			}
		});
	}
	
	/**
	 * for FX 来料检验单
	 * @param printer
	 * @param str
	 */
	public void PrintForFXLL(final String printer ,final String str) {
		try {
			PrintFXLL printData = new PrintFXLL();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String cusId = printData.getCusId();
			String mdlDsc = printData.getMdlDsc();
			String toThickness = printData.getToThickness();
			String mdlSubId = printData.getMdlSubId();
			String lotQty = printData.getLotQty();
			String defCnt = printData.getDefCnt();
			String checkUser = printData.getCheckUser();
			String mdlId = printData.getMdlId();
			String lotId = printData.getLotId();
			String prdStdQty = printData.getPrdStdQty();
			String wholeYield = printData.getWholeYield();
			String confirmUser = printData.getConfirmUser();
			List<String> prdId = printData.getPrdAry();
			List<String> cFAry = printData.getcFAry();
			List<String> tFTAry = printData.gettFTAry();
			List<String> remark = printData.getRemark();
			List<String> cdpcId = printData.getCdpcId();
			List<String> t001Ary = printData.getT001Ary();
			List<String> t002Ary = printData.getT002Ary();
			List<String> t003Ary = printData.getT003Ary();
			List<String> t004Ary = printData.getT004Ary();
			List<String> t005Ary = printData.getT005Ary();
			List<String> t006Ary = printData.getT006Ary();
			List<String> t007Ary = printData.getT007Ary();
			List<String> t008Ary = printData.getT008Ary();
			Integer cdpcCnt = printData.getCdpcCnt();
			
			int loopCnt = (int) Math.ceil(stdQty / 25);
			
			PrintFX excel = new PrintFX("1",loopCnt,true,"ALL");
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int k;
			int index = 1;
			int index_2 = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				
				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(4);
		        cell.setCellValue(mdlDsc);
		        cell = sheet.getRow(3).getCell(9);
		        cell.setCellValue(toThickness + "T");
		        cell = sheet.getRow(3).getCell(14);
		        cell.setCellValue(mdlSubId);
		        cell = sheet.getRow(3).getCell(18);
		        cell.setCellValue(lotQty);
		        cell = sheet.getRow(3).getCell(21);
		        cell.setCellValue(defCnt);
		        cell = sheet.getRow(3).getCell(22);
		        cell.setCellValue("检验员：" + checkUser);
		        
		        //第二排
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(4);
		        cell.setCellValue(lotId);
		        cell = sheet.getRow(4).getCell(9);
		        cell.setCellValue(prdStdQty);
		        cell = sheet.getRow(4).getCell(14);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(18);
		        cell.setCellValue(stdQty);
		        cell = sheet.getRow(4).getCell(21);
		        cell.setCellValue(wholeYield);
		        cell = sheet.getRow(4).getCell(22);
		        cell.setCellValue("确认人：" + confirmUser);
				for (j = 0; j < 25; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+7).getCell(0);
				        cell.setCellValue(index);
				        
				        if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						if(!Util.isEmptyString(cFAry.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(2);
					        cell.setCellValue(cFAry.get(index - 1));
						}
						if(!Util.isEmptyString(tFTAry.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(12);
					        cell.setCellValue(tFTAry.get(index - 1));
						}
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(22);
					        cell.setCellValue(remark.get(index - 1));
						}
					}
				}
				
				for (k = 0; k < 2; k++, index_2++) {
					if (index_2 <= cdpcCnt) {
						cell = sheet.getRow(33+k).getCell(1);
				        cell.setCellValue(cdpcId.get(index_2-1));
				        cell = sheet.getRow(33+k).getCell(2);
				        cell.setCellValue(t001Ary.get(index_2-1));
				        cell = sheet.getRow(33+k).getCell(3);
				        cell.setCellValue(t002Ary.get(index_2-1));
				        cell = sheet.getRow(33+k).getCell(4);
				        cell.setCellValue(t003Ary.get(index_2-1));
				        cell = sheet.getRow(33+k).getCell(5);
				        cell.setCellValue(t004Ary.get(index_2-1));
				        cell = sheet.getRow(33+k).getCell(6);
				        cell.setCellValue(t005Ary.get(index_2-1));
				        cell = sheet.getRow(33+k).getCell(7);
				        cell.setCellValue(t006Ary.get(index_2-1));
				        cell = sheet.getRow(33+k).getCell(8);
				        cell.setCellValue(t007Ary.get(index_2-1));
				        cell = sheet.getRow(33+k).getCell(9);
				        cell.setCellValue(t008Ary.get(index_2-1));
				        
				        if((index_2 + 2) <= cdpcCnt){
				        	cell = sheet.getRow(33+k).getCell(11);
					        cell.setCellValue(cdpcId.get(index_2-1+2));
					        cell = sheet.getRow(33+k).getCell(14);
					        cell.setCellValue(t001Ary.get(index_2-1+2));
					        cell = sheet.getRow(33+k).getCell(15);
					        cell.setCellValue(t002Ary.get(index_2-1+2));
					        cell = sheet.getRow(33+k).getCell(16);
					        cell.setCellValue(t003Ary.get(index_2-1+2));
					        cell = sheet.getRow(33+k).getCell(17);
					        cell.setCellValue(t004Ary.get(index_2-1+2));
					        cell = sheet.getRow(33+k).getCell(18);
					        cell.setCellValue(t005Ary.get(index_2-1+2));
					        cell = sheet.getRow(33+k).getCell(19);
					        cell.setCellValue(t006Ary.get(index_2-1+2));
					        cell = sheet.getRow(33+k).getCell(20);
					        cell.setCellValue(t007Ary.get(index_2-1+2));
					        cell = sheet.getRow(33+k).getCell(21);
					        cell.setCellValue(t008Ary.get(index_2-1+2));
						}
					}
				}
			}
			
			FileOutputStream fileOut = new FileOutputStream("C:/FXLL.xls");  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,"C:/FXLL.xls");
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * for FX 蚀刻检验单
	 * @param printer
	 * @param str
	 */
	public void PrintForFXSK(final String printer ,final String str) {
		try {
			PrintFXSK printData = new PrintFXSK();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String cusId = printData.getCusId();
			String mdlDsc = printData.getMdlDsc();
			String toThickness = printData.getToThickness();
			String mdlSubId = printData.getMdlSubId();
			String lotQty = printData.getLotQty();
			String defCnt = printData.getDefCnt();
			String checkUser = printData.getCheckUser();
			String mdlId = printData.getMdlId();
			String lotId = printData.getLotId();
			String prdStdQty = printData.getPrdStdQty();
			String wholeYield = printData.getWholeYield();
			String confirmUser = printData.getConfirmUser();
			List<String> prdId = printData.getPrdAry();
			List<String> hnblLlhxCntAry = printData.getHnblLlhxCntAry();
			List<String> syCntAry = printData.getSyCntAry();
			List<String> psCntAry = printData.getPsCntAry();
			List<String> cHsCntAry = printData.getcHsCntAry();
			List<String> cAdCntAry = printData.getcAdCntAry();
			List<String> cTdCntAry = printData.getcTdCntAry();
			List<String> cSkbjCntAry = printData.getcSkbjCntAry();
			List<String> cZwCntAry = printData.getcZwCntAry();
			List<String> cCjCntAry = printData.getcCjCntAry();
			List<String> cLyCntAry = printData.getcLyCntAry();
			List<String> cOtherAry = printData.getcOtherAry();
			List<String> tHsCntAry = printData.gettHsCntAry();
			List<String> tAdCntAry = printData.gettAdCntAry();
			List<String> tTdCntAry = printData.gettTdCntAry();
			List<String> tSkbjCntAry = printData.gettSkbjCntAry();
			List<String> tZwCntAry = printData.gettZwCntAry();
			List<String> tCjCntAry = printData.gettCjCntAry();
			List<String> tLyCntAry = printData.gettLyCntAry();
			List<String> tOtherAry = printData.gettOtherAry();
			List<String> cdpcId = printData.getCdpcId();
			List<String> t001Ary = printData.getT001Ary();
			List<String> t002Ary = printData.getT002Ary();
			List<String> t003Ary = printData.getT003Ary();
			List<String> t004Ary = printData.getT004Ary();
			List<String> t005Ary = printData.getT005Ary();
			List<String> t006Ary = printData.getT006Ary();
			List<String> t007Ary = printData.getT007Ary();
			List<String> t008Ary = printData.getT008Ary();
			List<String> t009Ary = printData.getT009Ary();
			Integer cdpcCnt = printData.getCdpcCnt();
			
			int loopCnt = (int) Math.ceil(stdQty / 25);
			
			PrintFX excel = new PrintFX("2",loopCnt,true,"ALL");
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int k;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				
				int totalDef1 = 0;
				int totalDef2 = 0;
				int totalDef3 = 0;
				int totalDef4 = 0;
				int totalDef5 = 0;
				int totalDef6 = 0;
				int totalDef7 = 0;
				int totalDef8 = 0;
				int totalDef9 = 0;
				int totalDef10 = 0;
				int totalDef11 = 0;
				int totalDef12 = 0;
				int totalDef13 = 0;
				int totalDef14 = 0;
				int totalDef15 = 0;
				int totalDef16 = 0;
				int totalDef17 = 0;
				int totalDef18 = 0;
				int totalDef19 = 0;
				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(4);
		        cell.setCellValue(mdlDsc);
		        cell = sheet.getRow(3).getCell(9);
		        cell.setCellValue(toThickness + "T");
		        cell = sheet.getRow(3).getCell(13);
		        cell.setCellValue(mdlSubId);
		        cell = sheet.getRow(3).getCell(16);
		        cell.setCellValue(lotQty);
		        cell = sheet.getRow(3).getCell(19);
		        cell.setCellValue(defCnt);
		        cell = sheet.getRow(3).getCell(21);
		        cell.setCellValue("检验员：" + checkUser);
		        
		        //第二排
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(4);
		        cell.setCellValue(lotId);
		        cell = sheet.getRow(4).getCell(9);
		        cell.setCellValue(prdStdQty);
		        cell = sheet.getRow(4).getCell(13);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(16);
		        cell.setCellValue(stdQty);
		        cell = sheet.getRow(4).getCell(19);
		        cell.setCellValue(wholeYield);
		        cell = sheet.getRow(4).getCell(21);
		        cell.setCellValue("确认人：" + confirmUser);
				for (j = 0; j < 25; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+8).getCell(0);
				        cell.setCellValue(index);
				        
				        if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
				        
				        if (!Util.isEmptyString(hnblLlhxCntAry.get(index - 1)) && Integer.parseInt(hnblLlhxCntAry.get(index - 1), 10) != 0) {
				        	totalDef1 = totalDef1 + Integer.parseInt(hnblLlhxCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(2);
					        cell.setCellValue(Integer.parseInt(hnblLlhxCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(syCntAry.get(index - 1)) && Integer.parseInt(syCntAry.get(index - 1), 10) != 0) {
				        	totalDef2 = totalDef2 + Integer.parseInt(syCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(3);
					        cell.setCellValue(Integer.parseInt(syCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(psCntAry.get(index - 1)) && Integer.parseInt(psCntAry.get(index - 1), 10) != 0) {
				        	totalDef3 = totalDef3 + Integer.parseInt(psCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(4);
					        cell.setCellValue(Integer.parseInt(psCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cHsCntAry.get(index - 1)) && Integer.parseInt(cHsCntAry.get(index - 1), 10) != 0) {
				        	totalDef4 = totalDef4 + Integer.parseInt(cHsCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(5);
					        cell.setCellValue(Integer.parseInt(cHsCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cAdCntAry.get(index - 1)) && Integer.parseInt(cAdCntAry.get(index - 1), 10) != 0) {
				        	totalDef5 = totalDef5 + Integer.parseInt(cAdCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(6);
					        cell.setCellValue(Integer.parseInt(cAdCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cTdCntAry.get(index - 1)) && Integer.parseInt(cTdCntAry.get(index - 1), 10) != 0) {
				        	totalDef6 = totalDef6 + Integer.parseInt(cTdCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(7);
					        cell.setCellValue(Integer.parseInt(cTdCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cSkbjCntAry.get(index - 1)) && Integer.parseInt(cSkbjCntAry.get(index - 1), 10) != 0) {
				        	totalDef7 = totalDef7 + Integer.parseInt(cSkbjCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(8);
					        cell.setCellValue(Integer.parseInt(cSkbjCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cZwCntAry.get(index - 1)) && Integer.parseInt(cZwCntAry.get(index - 1), 10) != 0) {
				        	totalDef8 = totalDef8 + Integer.parseInt(cZwCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(9);
					        cell.setCellValue(Integer.parseInt(cZwCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cCjCntAry.get(index - 1)) && Integer.parseInt(cCjCntAry.get(index - 1), 10) != 0) {
				        	totalDef9 = totalDef9 + Integer.parseInt(cCjCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(10);
					        cell.setCellValue(Integer.parseInt(cCjCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cLyCntAry.get(index - 1)) && Integer.parseInt(cLyCntAry.get(index - 1), 10) != 0) {
				        	totalDef10 = totalDef10 + Integer.parseInt(cLyCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(11);
					        cell.setCellValue(Integer.parseInt(cLyCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cOtherAry.get(index - 1)) && Integer.parseInt(cOtherAry.get(index - 1), 10) != 0) {
				        	totalDef11 = totalDef11 + Integer.parseInt(cOtherAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(12);
					        cell.setCellValue(Integer.parseInt(cOtherAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tHsCntAry.get(index - 1)) && Integer.parseInt(tHsCntAry.get(index - 1), 10) != 0) {
				        	totalDef12 = totalDef12 + Integer.parseInt(tHsCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(13);
					        cell.setCellValue(Integer.parseInt(tHsCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tAdCntAry.get(index - 1)) && Integer.parseInt(tAdCntAry.get(index - 1), 10) != 0) {
				        	totalDef13 = totalDef13 + Integer.parseInt(tAdCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(14);
					        cell.setCellValue(Integer.parseInt(tAdCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tTdCntAry.get(index - 1)) && Integer.parseInt(tTdCntAry.get(index - 1), 10) != 0) {
				        	totalDef14 = totalDef14 + Integer.parseInt(tTdCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(15);
					        cell.setCellValue(Integer.parseInt(tTdCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tSkbjCntAry.get(index - 1)) && Integer.parseInt(tSkbjCntAry.get(index - 1), 10) != 0) {
				        	totalDef15 = totalDef15 + Integer.parseInt(tSkbjCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(16);
					        cell.setCellValue(Integer.parseInt(tSkbjCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tZwCntAry.get(index - 1)) && Integer.parseInt(tZwCntAry.get(index - 1), 10) != 0) {
				        	totalDef16 = totalDef16 + Integer.parseInt(tZwCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(17);
					        cell.setCellValue(Integer.parseInt(tZwCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tCjCntAry.get(index - 1)) && Integer.parseInt(tCjCntAry.get(index - 1), 10) != 0) {
				        	totalDef17 = totalDef17 + Integer.parseInt(tCjCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(18);
					        cell.setCellValue(Integer.parseInt(tCjCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tLyCntAry.get(index - 1)) && Integer.parseInt(tLyCntAry.get(index - 1), 10) != 0) {
				        	totalDef18 = totalDef18 + Integer.parseInt(tLyCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(19);
					        cell.setCellValue(Integer.parseInt(tLyCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tOtherAry.get(index - 1)) && Integer.parseInt(tOtherAry.get(index - 1), 10) != 0) {
				        	totalDef19 = totalDef19 + Integer.parseInt(tOtherAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(20);
					        cell.setCellValue(Integer.parseInt(tOtherAry.get(index - 1), 10));
						}
					}
				}
				
				
				for(k = 0; k < cdpcCnt; k++){
					cell = sheet.getRow(34+k).getCell(1);
			        cell.setCellValue(cdpcId.get(k));
			        cell = sheet.getRow(34+k).getCell(2);
			        cell.setCellValue(t001Ary.get(k));
			        cell = sheet.getRow(34+k).getCell(3);
			        cell.setCellValue(t002Ary.get(k));
			        cell = sheet.getRow(34+k).getCell(4);
			        cell.setCellValue(t003Ary.get(k));
			        cell = sheet.getRow(34+k).getCell(5);
			        cell.setCellValue(t004Ary.get(k));
			        cell = sheet.getRow(34+k).getCell(6);
			        cell.setCellValue(t005Ary.get(k));
			        cell = sheet.getRow(34+k).getCell(7);
			        cell.setCellValue(t006Ary.get(k));
			        cell = sheet.getRow(34+k).getCell(8);
			        cell.setCellValue(t007Ary.get(k));
			        cell = sheet.getRow(34+k).getCell(9);
			        cell.setCellValue(t008Ary.get(k));
			        cell = sheet.getRow(34+k).getCell(10);
			        cell.setCellValue(t009Ary.get(k));
				}
				
				cell = sheet.getRow(33).getCell(2);
		        cell.setCellValue(totalDef1);
				cell = sheet.getRow(33).getCell(3);
		        cell.setCellValue(totalDef2);
		        cell = sheet.getRow(33).getCell(4);
		        cell.setCellValue(totalDef3);
		        cell = sheet.getRow(33).getCell(5);
		        cell.setCellValue(totalDef4);
		        cell = sheet.getRow(33).getCell(6);
		        cell.setCellValue(totalDef5);
		        cell = sheet.getRow(33).getCell(7);
		        cell.setCellValue(totalDef6);
		        cell = sheet.getRow(33).getCell(8);
		        cell.setCellValue(totalDef7);
		        cell = sheet.getRow(33).getCell(9);
		        cell.setCellValue(totalDef8);
		        cell = sheet.getRow(33).getCell(10);
		        cell.setCellValue(totalDef9);
		        cell = sheet.getRow(33).getCell(11);
		        cell.setCellValue(totalDef10);
		        cell = sheet.getRow(33).getCell(12);
		        cell.setCellValue(totalDef11);
		        cell = sheet.getRow(33).getCell(13);
		        cell.setCellValue(totalDef12);
		        cell = sheet.getRow(33).getCell(14);
		        cell.setCellValue(totalDef13);
		        cell = sheet.getRow(33).getCell(15);
		        cell.setCellValue(totalDef14);
		        cell = sheet.getRow(33).getCell(16);
		        cell.setCellValue(totalDef15);
		        cell = sheet.getRow(33).getCell(17);
		        cell.setCellValue(totalDef16);
		        cell = sheet.getRow(33).getCell(18);
		        cell.setCellValue(totalDef17);
		        cell = sheet.getRow(33).getCell(19);
		        cell.setCellValue(totalDef18);
		        cell = sheet.getRow(33).getCell(20);
		        cell.setCellValue(totalDef19);
			}
			
			FileOutputStream fileOut = new FileOutputStream("C:/FXSK.xls");  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,"C:/FXSK.xls");
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}

	/**
	 * for FX 产品异转追踪表
	 * @param printer
	 * @param str
	 */
	public void PrintForFXYZ(final String printer ,final String str) {
		try {
			PrintFXYZ printData = new PrintFXYZ();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String cusId = printData.getCusId();
			String mdlDsc = printData.getMdlDsc();
			String toThickness = printData.getToThickness();
			String mdlSubId = printData.getMdlSubId();
			String checkUser = printData.getCheckUser();
			String mdlId = printData.getMdlId();
			String prdStdQty = printData.getPrdStdQty();
			String woId = printData.getWoId();
			String opeDsc = printData.getOpeDsc();
			String boxId = printData.getBoxId();
			String confirmUser = printData.getConfirmUser();
			List<String> prdId = printData.getPrdAry();
			List<String> hnblLlhxCntAry = printData.getHnblLlhxCntAry();
			List<String> syCntAry = printData.getSyCntAry();
			List<String> psCntAry = printData.getPsCntAry();
			List<String> cHsCntAry = printData.getcHsCntAry();
			List<String> cAdCntAry = printData.getcAdCntAry();
			List<String> cTdCntAry = printData.getcTdCntAry();
			List<String> cSkbjCntAry = printData.getcSkbjCntAry();
			List<String> cZwCntAry = printData.getcZwCntAry();
			List<String> cCjCntAry = printData.getcCjCntAry();
			List<String> cLyCntAry = printData.getcLyCntAry();
			List<String> cOtherAry = printData.getcOtherAry();
			List<String> tHsCntAry = printData.gettHsCntAry();
			List<String> tAdCntAry = printData.gettAdCntAry();
			List<String> tTdCntAry = printData.gettTdCntAry();
			List<String> tSkbjCntAry = printData.gettSkbjCntAry();
			List<String> tZwCntAry = printData.gettZwCntAry();
			List<String> tCjCntAry = printData.gettCjCntAry();
			List<String> tLyCntAry = printData.gettLyCntAry();
			List<String> tOtherAry = printData.gettOtherAry();
			List<String> cdpcId = printData.getCdpcId();
			List<String> t001Ary = printData.getT001Ary();
			List<String> t002Ary = printData.getT002Ary();
			List<String> t003Ary = printData.getT003Ary();
			List<String> t004Ary = printData.getT004Ary();
			List<String> t005Ary = printData.getT005Ary();
			List<String> t006Ary = printData.getT006Ary();
			List<String> t007Ary = printData.getT007Ary();
			List<String> t008Ary = printData.getT008Ary();
			Integer cdpcCnt = printData.getCdpcCnt();
			
			int loopCnt = (int) Math.ceil(stdQty / 25);
			
			PrintFX excel = new PrintFX("4",loopCnt,true,"ALL");
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int k;
			int index = 1;
			int index_2 = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				
				int totalDef1 = 0;
				int totalDef2 = 0;
				int totalDef3 = 0;
				int totalDef4 = 0;
				int totalDef5 = 0;
				int totalDef6 = 0;
				int totalDef7 = 0;
				int totalDef8 = 0;
				int totalDef9 = 0;
				int totalDef10 = 0;
				int totalDef11 = 0;
				int totalDef12 = 0;
				int totalDef13 = 0;
				int totalDef14 = 0;
				int totalDef15 = 0;
				int totalDef16 = 0;
				int totalDef17 = 0;
				int totalDef18 = 0;
				int totalDef19 = 0;
				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(4);
		        cell.setCellValue(mdlDsc);
		        cell = sheet.getRow(3).getCell(8);
		        cell.setCellValue(toThickness + "T");
		        cell = sheet.getRow(3).getCell(13);
		        cell.setCellValue(mdlSubId);
		        cell = sheet.getRow(3).getCell(18);
		        cell.setCellValue(stdQty);
		        cell = sheet.getRow(3).getCell(22);
		        cell.setCellValue(checkUser);
		        
		        //第二排
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(4);
		        cell.setCellValue(prdStdQty);
		        cell = sheet.getRow(4).getCell(8);
		        cell.setCellValue(woId);
		        cell = sheet.getRow(4).getCell(13);
		        cell.setCellValue(opeDsc);
		        cell = sheet.getRow(4).getCell(18);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(4).getCell(22);
		        cell.setCellValue(confirmUser);
				for (j = 0; j < 25; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+8).getCell(0);
				        cell.setCellValue(index);
				        
				        if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
				        
				        if (!Util.isEmptyString(hnblLlhxCntAry.get(index - 1)) && Integer.parseInt(hnblLlhxCntAry.get(index - 1), 10) != 0) {
				        	totalDef1 = totalDef1 + Integer.parseInt(hnblLlhxCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(2);
					        cell.setCellValue(Integer.parseInt(hnblLlhxCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(syCntAry.get(index - 1)) && Integer.parseInt(syCntAry.get(index - 1), 10) != 0) {
				        	totalDef2 = totalDef2 + Integer.parseInt(syCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(3);
					        cell.setCellValue(Integer.parseInt(syCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(psCntAry.get(index - 1)) && Integer.parseInt(psCntAry.get(index - 1), 10) != 0) {
				        	totalDef3 = totalDef3 + Integer.parseInt(psCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(4);
					        cell.setCellValue(Integer.parseInt(psCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cHsCntAry.get(index - 1)) && Integer.parseInt(cHsCntAry.get(index - 1), 10) != 0) {
				        	totalDef4 = totalDef4 + Integer.parseInt(cHsCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(5);
					        cell.setCellValue(Integer.parseInt(cHsCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cAdCntAry.get(index - 1)) && Integer.parseInt(cAdCntAry.get(index - 1), 10) != 0) {
				        	totalDef5 = totalDef5 + Integer.parseInt(cAdCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(6);
					        cell.setCellValue(Integer.parseInt(cAdCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cTdCntAry.get(index - 1)) && Integer.parseInt(cTdCntAry.get(index - 1), 10) != 0) {
				        	totalDef6 = totalDef6 + Integer.parseInt(cTdCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(7);
					        cell.setCellValue(Integer.parseInt(cTdCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cSkbjCntAry.get(index - 1)) && Integer.parseInt(cSkbjCntAry.get(index - 1), 10) != 0) {
				        	totalDef7 = totalDef7 + Integer.parseInt(cSkbjCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(8);
					        cell.setCellValue(Integer.parseInt(cSkbjCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cZwCntAry.get(index - 1)) && Integer.parseInt(cZwCntAry.get(index - 1), 10) != 0) {
				        	totalDef8 = totalDef8 + Integer.parseInt(cZwCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(9);
					        cell.setCellValue(Integer.parseInt(cZwCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cCjCntAry.get(index - 1)) && Integer.parseInt(cCjCntAry.get(index - 1), 10) != 0) {
				        	totalDef9 = totalDef9 + Integer.parseInt(cCjCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(10);
					        cell.setCellValue(Integer.parseInt(cCjCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cLyCntAry.get(index - 1)) && Integer.parseInt(cLyCntAry.get(index - 1), 10) != 0) {
				        	totalDef10 = totalDef10 + Integer.parseInt(cLyCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(11);
					        cell.setCellValue(Integer.parseInt(cLyCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cOtherAry.get(index - 1)) && Integer.parseInt(cOtherAry.get(index - 1), 10) != 0) {
				        	totalDef11 = totalDef11 + Integer.parseInt(cOtherAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(12);
					        cell.setCellValue(Integer.parseInt(cOtherAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tHsCntAry.get(index - 1)) && Integer.parseInt(tHsCntAry.get(index - 1), 10) != 0) {
				        	totalDef12 = totalDef12 + Integer.parseInt(tHsCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(13);
					        cell.setCellValue(Integer.parseInt(tHsCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tAdCntAry.get(index - 1)) && Integer.parseInt(tAdCntAry.get(index - 1), 10) != 0) {
				        	totalDef13 = totalDef13 + Integer.parseInt(tAdCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(14);
					        cell.setCellValue(Integer.parseInt(tAdCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tTdCntAry.get(index - 1)) && Integer.parseInt(tTdCntAry.get(index - 1), 10) != 0) {
				        	totalDef14 = totalDef14 + Integer.parseInt(tTdCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(15);
					        cell.setCellValue(Integer.parseInt(tTdCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tSkbjCntAry.get(index - 1)) && Integer.parseInt(tSkbjCntAry.get(index - 1), 10) != 0) {
				        	totalDef15 = totalDef15 + Integer.parseInt(tSkbjCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(16);
					        cell.setCellValue(Integer.parseInt(tSkbjCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tZwCntAry.get(index - 1)) && Integer.parseInt(tZwCntAry.get(index - 1), 10) != 0) {
				        	totalDef16 = totalDef16 + Integer.parseInt(tZwCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(17);
					        cell.setCellValue(Integer.parseInt(tZwCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tCjCntAry.get(index - 1)) && Integer.parseInt(tCjCntAry.get(index - 1), 10) != 0) {
				        	totalDef17 = totalDef17 + Integer.parseInt(tCjCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(18);
					        cell.setCellValue(Integer.parseInt(tCjCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tLyCntAry.get(index - 1)) && Integer.parseInt(tLyCntAry.get(index - 1), 10) != 0) {
				        	totalDef18 = totalDef18 + Integer.parseInt(tLyCntAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(19);
					        cell.setCellValue(Integer.parseInt(tLyCntAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tOtherAry.get(index - 1)) && Integer.parseInt(tOtherAry.get(index - 1), 10) != 0) {
				        	totalDef19 = totalDef19 + Integer.parseInt(tOtherAry.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(20);
					        cell.setCellValue(Integer.parseInt(tOtherAry.get(index - 1), 10));
						}
					}
				}
				
				for (k = 0; k < 2; k++, index_2++) {
					if (index_2 <= cdpcCnt) {
						cell = sheet.getRow(34+k).getCell(1);
				        cell.setCellValue(cdpcId.get(index_2-1));
				        cell = sheet.getRow(34+k).getCell(2);
				        cell.setCellValue(t001Ary.get(index_2-1));
				        cell = sheet.getRow(34+k).getCell(3);
				        cell.setCellValue(t002Ary.get(index_2-1));
				        cell = sheet.getRow(34+k).getCell(4);
				        cell.setCellValue(t003Ary.get(index_2-1));
				        cell = sheet.getRow(34+k).getCell(5);
				        cell.setCellValue(t004Ary.get(index_2-1));
				        cell = sheet.getRow(34+k).getCell(6);
				        cell.setCellValue(t005Ary.get(index_2-1));
				        cell = sheet.getRow(34+k).getCell(7);
				        cell.setCellValue(t006Ary.get(index_2-1));
				        cell = sheet.getRow(34+k).getCell(8);
				        cell.setCellValue(t007Ary.get(index_2-1));
				        cell = sheet.getRow(34+k).getCell(9);
				        cell.setCellValue(t008Ary.get(index_2-1));
				        
				        if((index_2 + 2) <= cdpcCnt){
				        	cell = sheet.getRow(34+k).getCell(12);
					        cell.setCellValue(cdpcId.get(index_2-1+2));
					        cell = sheet.getRow(34+k).getCell(16);
					        cell.setCellValue(t001Ary.get(index_2-1+2));
					        cell = sheet.getRow(34+k).getCell(17);
					        cell.setCellValue(t002Ary.get(index_2-1+2));
					        cell = sheet.getRow(34+k).getCell(18);
					        cell.setCellValue(t003Ary.get(index_2-1+2));
					        cell = sheet.getRow(34+k).getCell(19);
					        cell.setCellValue(t004Ary.get(index_2-1+2));
					        cell = sheet.getRow(34+k).getCell(20);
					        cell.setCellValue(t005Ary.get(index_2-1+2));
					        cell = sheet.getRow(34+k).getCell(21);
					        cell.setCellValue(t006Ary.get(index_2-1+2));
					        cell = sheet.getRow(34+k).getCell(22);
					        cell.setCellValue(t007Ary.get(index_2-1+2));
					        cell = sheet.getRow(34+k).getCell(23);
					        cell.setCellValue(t008Ary.get(index_2-1+2));
						}
					}
				}
				cell = sheet.getRow(33).getCell(2);
		        cell.setCellValue(totalDef1);
				cell = sheet.getRow(33).getCell(3);
		        cell.setCellValue(totalDef2);
		        cell = sheet.getRow(33).getCell(4);
		        cell.setCellValue(totalDef3);
		        cell = sheet.getRow(33).getCell(5);
		        cell.setCellValue(totalDef4);
		        cell = sheet.getRow(33).getCell(6);
		        cell.setCellValue(totalDef5);
		        cell = sheet.getRow(33).getCell(7);
		        cell.setCellValue(totalDef6);
		        cell = sheet.getRow(33).getCell(8);
		        cell.setCellValue(totalDef7);
		        cell = sheet.getRow(33).getCell(9);
		        cell.setCellValue(totalDef8);
		        cell = sheet.getRow(33).getCell(10);
		        cell.setCellValue(totalDef9);
		        cell = sheet.getRow(33).getCell(11);
		        cell.setCellValue(totalDef10);
		        cell = sheet.getRow(33).getCell(12);
		        cell.setCellValue(totalDef11);
		        cell = sheet.getRow(33).getCell(13);
		        cell.setCellValue(totalDef12);
		        cell = sheet.getRow(33).getCell(14);
		        cell.setCellValue(totalDef13);
		        cell = sheet.getRow(33).getCell(15);
		        cell.setCellValue(totalDef14);
		        cell = sheet.getRow(33).getCell(16);
		        cell.setCellValue(totalDef15);
		        cell = sheet.getRow(33).getCell(17);
		        cell.setCellValue(totalDef16);
		        cell = sheet.getRow(33).getCell(18);
		        cell.setCellValue(totalDef17);
		        cell = sheet.getRow(33).getCell(19);
		        cell.setCellValue(totalDef18);
		        cell = sheet.getRow(33).getCell(20);
		        cell.setCellValue(totalDef19);
			}
			
			FileOutputStream fileOut = new FileOutputStream("C:/FXYZ.xls");  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,"C:/FXYZ.xls");
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * FX for 017天马客户出货信息表
	 * @param printer
	 * @param str
	 */
	public void PrintForFX017(final String printer ,final String str) {
		try {
			PrintFX017 printData = new PrintFX017();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String cusDsc = printData.getCusDsc();
			String soId = printData.getSoId();
			String boxId = printData.getBoxId();
			String toThickness = printData.getToThickness();
			String mdlId = printData.getMdlId();
			String modelCnt = printData.getModelCnt();
			String woId = printData.getWoId();
			List<String> prdAry = printData.getPrdAry();
			List<String> mtrlBoxAry = printData.getMtrlBoxAry();
			List<String> czPlAry = printData.getCzPlAry();
			List<String> czLyAry = printData.getCzLyAry();
			List<String> czZwAry = printData.getCzZwAry();
			List<String> czSkbjAry = printData.getCzSkbjAry();
			List<String> czAtdAry = printData.getCzAtdAry();
			List<String> czHsAry = printData.getCzHsAry();
			List<String> clPlAry = printData.getClPlAry();
			List<String> clYjycAry = printData.getClYjycAry();
			List<String> clAdAry = printData.getClAdAry();
			List<String> clMjadAry = printData.getClMjadAry();
			List<String> clHsAry = printData.getClHsAry();
			List<String> clGlyAry = printData.getClGlyAry();
			List<String> clXpyAry = printData.getClXpyAry();
			List<String> tzZwAry = printData.getTzZwAry();
			List<String> tzSkbjAry = printData.getTzSkbjAry();
			List<String> tzAtdAry = printData.getTzAtdAry();
			List<String> tzHsAry = printData.getTzHsAry();
			List<String> tlAdAry = printData.getTlAdAry();
			List<String> tlGlxadAry = printData.getTlGlxadAry();
			List<String> tlHsAry = printData.getTlHsAry();
			List<String> tlXpyAry = printData.getTlXpyAry();
			List<String> tlGlyAry = printData.getTlGlyAry();
			List<String> statusAry = printData.getStatusAry();
			List<String> remarkAry = printData.getRemarkAry();
			
			int loopCnt = (int) Math.ceil(stdQty / 30);
			
			PrintFX excel = new PrintFX("3",loopCnt,false,"017");
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				
				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusDsc);
		        cell = sheet.getRow(3).getCell(7);
		        cell.setCellValue(soId);
		        cell = sheet.getRow(3).getCell(14);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(23);
		        cell.setCellValue(toThickness + "mm");
		        cell = sheet.getRow(3).getCell(27);
		        cell.setCellValue(mdlId);
		        
		        //第二排
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(7);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(23);
		        cell.setCellValue(modelCnt);
		        cell = sheet.getRow(4).getCell(27);
		        cell.setCellValue(woId);
				for (j = 0; j < 30; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+7).getCell(0);
				        cell.setCellValue(index);
				        
				        if(!Util.isEmptyString(prdAry.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(1);
					        cell.setCellValue(prdAry.get(index - 1));
						}
				        
				        if(!Util.isEmptyString(mtrlBoxAry.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(2);
					        cell.setCellValue(mtrlBoxAry.get(index - 1));
						}
				        
				        if(!Util.isEmptyString(statusAry.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(3);
					        cell.setCellValue(statusAry.get(index - 1));
						}
				        
				        if (!Util.isEmptyString(czPlAry.get(index - 1)) && Integer.parseInt(czPlAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(4);
					        cell.setCellValue(Integer.parseInt(czPlAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(czLyAry.get(index - 1)) && Integer.parseInt(czLyAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(5);
					        cell.setCellValue(Integer.parseInt(czLyAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(czZwAry.get(index - 1)) && Integer.parseInt(czZwAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(6);
					        cell.setCellValue(Integer.parseInt(czZwAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(czSkbjAry.get(index - 1)) && Integer.parseInt(czSkbjAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(7);
					        cell.setCellValue(Integer.parseInt(czSkbjAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(czAtdAry.get(index - 1)) && Integer.parseInt(czAtdAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(8);
					        cell.setCellValue(Integer.parseInt(czAtdAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(czHsAry.get(index - 1)) && Integer.parseInt(czHsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(9);
					        cell.setCellValue(Integer.parseInt(czHsAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(clPlAry.get(index - 1)) && Integer.parseInt(clPlAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(10);
					        cell.setCellValue(Integer.parseInt(clPlAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(clYjycAry.get(index - 1)) && Integer.parseInt(clYjycAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(11);
					        cell.setCellValue(Integer.parseInt(clYjycAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(clAdAry.get(index - 1)) && Integer.parseInt(clAdAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(12);
					        cell.setCellValue(Integer.parseInt(clAdAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(clMjadAry.get(index - 1)) && Integer.parseInt(clMjadAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(13);
					        cell.setCellValue(Integer.parseInt(clMjadAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(clHsAry.get(index - 1)) && Integer.parseInt(clHsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(14);
					        cell.setCellValue(Integer.parseInt(clHsAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(clGlyAry.get(index - 1)) && Integer.parseInt(clGlyAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(15);
					        cell.setCellValue(Integer.parseInt(clGlyAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(clXpyAry.get(index - 1)) && Integer.parseInt(clXpyAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(16);
					        cell.setCellValue(Integer.parseInt(clXpyAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tzZwAry.get(index - 1)) && Integer.parseInt(tzZwAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(17);
					        cell.setCellValue(Integer.parseInt(tzZwAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tzSkbjAry.get(index - 1)) && Integer.parseInt(tzSkbjAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(18);
					        cell.setCellValue(Integer.parseInt(tzSkbjAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tzAtdAry.get(index - 1)) && Integer.parseInt(tzAtdAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(19);
					        cell.setCellValue(Integer.parseInt(tzAtdAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tzHsAry.get(index - 1)) && Integer.parseInt(tzHsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(20);
					        cell.setCellValue(Integer.parseInt(tzHsAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tlAdAry.get(index - 1)) && Integer.parseInt(tlAdAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(21);
					        cell.setCellValue(Integer.parseInt(tlAdAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tlGlxadAry.get(index - 1)) && Integer.parseInt(tlGlxadAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(22);
					        cell.setCellValue(Integer.parseInt(tlGlxadAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tlHsAry.get(index - 1)) && Integer.parseInt(tlHsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(23);
					        cell.setCellValue(Integer.parseInt(tlHsAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tlXpyAry.get(index - 1)) && Integer.parseInt(tlXpyAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(24);
					        cell.setCellValue(Integer.parseInt(tlXpyAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tlGlyAry.get(index - 1)) && Integer.parseInt(tlGlyAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+7).getCell(25);
					        cell.setCellValue(Integer.parseInt(tlGlyAry.get(index - 1), 10));
						}
				        
				        if(!Util.isEmptyString(remarkAry.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(27);
					        cell.setCellValue(remarkAry.get(index - 1));
						}
					}
				}
			}
			
			FileOutputStream fileOut = new FileOutputStream("C:/FX017.xls");  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,"C:/FX017.xls");
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * FX for 017天马客户出货信息表2
	 * @param printer
	 * @param str
	 */
	public void PrintForFX017_2(final String printer ,final String str) {
		try {
			PrintFX017 printData = new PrintFX017();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			String print_date = JackUtil.getCurDate();
			Integer prd_cnt = printData.getPrd_cnt();
			String woDsc = printData.getWoDsc();
			String fmMdlId = printData.getFmMdlId();
			String soId = printData.getSoId();
			String boxId = printData.getBoxId();
			String toThickness = printData.getToThickness();
			String soDsc = printData.getSoDsc();
			
			PrintFX excel = new PrintFX("6",1,false,"017");
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
	        //读取了workbook内sheet内容  
			HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(1)));
			
	        HSSFCell cell = sheet.getRow(4).getCell(1);
	        cell.setCellValue(woDsc);
	        cell = sheet.getRow(5).getCell(1);
	        cell.setCellValue(fmMdlId);
	        cell = sheet.getRow(6).getCell(1);
	        cell.setCellValue(soId);
	        cell = sheet.getRow(6).getCell(4);
	        cell.setCellValue(boxId);
	        cell = sheet.getRow(7).getCell(1);
	        cell.setCellValue(print_date);
	        cell = sheet.getRow(7).getCell(4);
	        cell.setCellValue(JackUtil.getMonthDateAfter(print_date, 6));
	        cell = sheet.getRow(8).getCell(1);
	        cell.setCellValue(prd_cnt);
			
	        cell = sheet.getRow(14).getCell(0);
	        cell.setCellValue("订单号：" + soId);
	        cell = sheet.getRow(14).getCell(3);
	        cell.setCellValue("日期：" + print_date.substring(0,4) + "年" + print_date.substring(5, 7) + "月" + print_date.substring(8, 10) + "日");
	        cell = sheet.getRow(15).getCell(1);
	        cell.setCellValue("品名：" + fmMdlId);
	        cell = sheet.getRow(15).getCell(3);
	        cell.setCellValue("目标厚度：" + toThickness + " T");
	        cell = sheet.getRow(18).getCell(1);
	        cell.setCellValue("工单号：" + soDsc);
	        cell = sheet.getRow(18).getCell(3);
	        cell.setCellValue("数量：" + prd_cnt + " sht");
	        cell = sheet.getRow(19).getCell(1);
	        cell.setCellValue("箱号（Lot.No）：" + boxId);
	        
			FileOutputStream fileOut = new FileOutputStream("C:/FX017_2.xls");  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,"C:/FX017_2.xls");
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * FX for 016中航客户出货信息表  // ynk  for 厦门天马
	 * @param printer
	 * @param str
	 */
	public void PrintForFX016(final String printer ,final String str) {
		try {
			PrintFX016 printData = new PrintFX016();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String cusDsc = printData.getCusDsc();
			String mdlTyp = printData.getMdlTyp();
			String boxId = printData.getBoxId();
			String mdlId = printData.getMdlId();
			String modelCnt = printData.getModelCnt();
			String woId = printData.getWoId();
			List<String> prdAry = printData.getPrdAry();
			List<String> yjycAry = printData.getYjycAry();
			List<String> syAry = printData.getSyAry();
			List<String> cHsAry = printData.getcHsAry();
			List<String> cAdAry = printData.getcAdAry();
			List<String> cTdAry = printData.getcTdAry();
			List<String> cSsbjAry = printData.getcSsbjAry();
			List<String> cPsAry = printData.getcPsAry();
			List<String> cZwAry = printData.getcZwAry();
			List<String> cLyAry = printData.getcLyAry();
			List<String> cOtherAry = printData.getcOtherAry();
			List<String> tHsAry = printData.gettHsAry();
			List<String> tAdAry = printData.gettAdAry();
			List<String> tTdAry = printData.gettTdAry();
			List<String> tSsbjAry = printData.gettSsbjAry();
			List<String> tPsAry = printData.gettPsAry();
			List<String> tZwAry = printData.gettZwAry();
			List<String> tLyAry = printData.gettLyAry();
			List<String> tOtherAry = printData.gettOtherAry();
			List<String> remarkAry = printData.getRemarkAry();
			
			int loopCnt = (int) Math.ceil(stdQty / 25);
			
			PrintFX excel = new PrintFX("5",loopCnt,true,"016");
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				
				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusDsc);
		        cell = sheet.getRow(3).getCell(5);
		        cell.setCellValue(mdlTyp);
		        cell = sheet.getRow(3).getCell(10);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(16);
		        cell.setCellValue(stdQty);
		        
		        //第二排
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(5);
		        cell.setCellValue(woId.length()>10 ? woId.substring(woId.length()-10,woId.length()) : woId);
		        cell = sheet.getRow(4).getCell(10);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(16);
		        cell.setCellValue(modelCnt);
		        
				for (j = 0; j < 25; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+8).getCell(0);
				        cell.setCellValue(index);
				        
				        if(!Util.isEmptyString(prdAry.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(1);
					        cell.setCellValue(prdAry.get(index - 1));
						}
				        
				        if (!Util.isEmptyString(yjycAry.get(index - 1)) && Integer.parseInt(yjycAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(2);
					        cell.setCellValue(Integer.parseInt(yjycAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(syAry.get(index - 1)) && Integer.parseInt(syAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(3);
					        cell.setCellValue(Integer.parseInt(syAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cHsAry.get(index - 1)) && Integer.parseInt(cHsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(4);
					        cell.setCellValue(Integer.parseInt(cHsAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cAdAry.get(index - 1)) && Integer.parseInt(cAdAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(5);
					        cell.setCellValue(Integer.parseInt(cAdAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cTdAry.get(index - 1)) && Integer.parseInt(cTdAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(6);
					        cell.setCellValue(Integer.parseInt(cTdAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cSsbjAry.get(index - 1)) && Integer.parseInt(cSsbjAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(7);
					        cell.setCellValue(Integer.parseInt(cSsbjAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cPsAry.get(index - 1)) && Integer.parseInt(cPsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(8);
					        cell.setCellValue(Integer.parseInt(cPsAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cZwAry.get(index - 1)) && Integer.parseInt(cZwAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(9);
					        cell.setCellValue(Integer.parseInt(cZwAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cLyAry.get(index - 1)) && Integer.parseInt(cLyAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(10);
					        cell.setCellValue(Integer.parseInt(cLyAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(cOtherAry.get(index - 1)) && Integer.parseInt(cOtherAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(11);
					        cell.setCellValue(Integer.parseInt(cOtherAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tHsAry.get(index - 1)) && Integer.parseInt(tHsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(12);
					        cell.setCellValue(Integer.parseInt(tHsAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tAdAry.get(index - 1)) && Integer.parseInt(tAdAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(13);
					        cell.setCellValue(Integer.parseInt(tAdAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tTdAry.get(index - 1)) && Integer.parseInt(tTdAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(14);
					        cell.setCellValue(Integer.parseInt(tTdAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tSsbjAry.get(index - 1)) && Integer.parseInt(tSsbjAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(15);
					        cell.setCellValue(Integer.parseInt(tSsbjAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tPsAry.get(index - 1)) && Integer.parseInt(tPsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(16);
					        cell.setCellValue(Integer.parseInt(tPsAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tZwAry.get(index - 1)) && Integer.parseInt(tZwAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(17);
					        cell.setCellValue(Integer.parseInt(tZwAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tLyAry.get(index - 1)) && Integer.parseInt(tLyAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(18);
					        cell.setCellValue(Integer.parseInt(tLyAry.get(index - 1), 10));
						}
				        if (!Util.isEmptyString(tOtherAry.get(index - 1)) && Integer.parseInt(tOtherAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+8).getCell(19);
					        cell.setCellValue(Integer.parseInt(tOtherAry.get(index - 1), 10));
						}
				        
				        if(!Util.isEmptyString(remarkAry.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(20);
					        cell.setCellValue(remarkAry.get(index - 1));
						}
					}
				}
			}
			
			FileOutputStream fileOut = new FileOutputStream("C:/FX016.xls");  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,"C:/FX016.xls");
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * 中板（大板）深超产品标示单
	 */
	public void PrintForFXBSD(final String printer ,final String str){
		try {
			PrintFXBSD printData = new PrintFXBSD();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			String printTyp = printData.getPrintTyp();
			String soDsc = printData.getSoDsc();
			double stdQty = printData.getStdQty();
			String mdlTyp = printData.getMdlTyp();
			String boxId = printData.getBoxId();
			String mdlId = printData.getMdlId();
			String modelTotalCnt = printData.getModelTotalCnt();
			List<String> prdAry = printData.getPrdAry();
			String onlyExport = printData.getOnlyExport();
			
			int prdCnt = 40;
			if("L".equals(printTyp)){
				prdCnt = 60;
			}
			
			PrintFX excel = new PrintFX("7",1,false,"ALL");
			if("L".equals(printTyp)){
				excel = new PrintFX("8",1,false,"ALL");
			}
			
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			//读取了workbook内sheet内容  
			HSSFSheet sheet = workbook.getSheet("sheet1");
			
			//第一行
	        HSSFCell cell = sheet.getRow(1).getCell(1);
	        cell.setCellValue(soDsc);
	        
	        //第二排
	        cell = sheet.getRow(2).getCell(1);
	        cell.setCellValue("长" + mdlTyp.split("\\*")[0] + "(mm)*宽" + mdlTyp.split("\\*")[1] + "(mm)");
	        cell = sheet.getRow(2).getCell(4);
	        cell.setCellValue(mdlId);
	        
	        //第三排
	        cell = sheet.getRow(3).getCell(1);
	        cell.setCellValue(JackUtil.getCurDate());
	        cell = sheet.getRow(3).getCell(4);
	        cell.setCellValue((int) stdQty + "Block(" + modelTotalCnt + "CP)");
	        
	        //第四排
	        cell = sheet.getRow(4).getCell(1);
	        cell.setCellValue(boxId);
	        
			for (i = 0; i < prdCnt/2; i++) {
		        if(i < stdQty && !Util.isEmptyString(prdAry.get(i))){
					cell = sheet.getRow(i+7).getCell(2);
			        cell.setCellValue(prdAry.get(i));
				}
		        
		        if((i+prdCnt/2) < stdQty && !Util.isEmptyString(prdAry.get(i+prdCnt/2))){
					cell = sheet.getRow(i+7).getCell(5);
			        cell.setCellValue(prdAry.get(i+prdCnt/2));
				}
			}
			
			//打印时间
			if("L".equals(printTyp)){//大板从38行打印
				cell = sheet.getRow(38).getCell(5);
			}else{//中板从28行开始
				cell = sheet.getRow(28).getCell(5);
			}
			cell.setCellValue(JackUtil.getCurTime2());
			
			String filename = excel.creatBSDFile(boxId);
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close();
			if(!"Y".equals(onlyExport)){
		        excel.printExcel(printer,filename);
			}
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * 厂内箱号条码
	 * @param printer
	 * @param box_id
	 */
	public void PrintBox(final String printer, final String box_id) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct32");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct32", printer, box_id);

				return null;
			}
		});
	}
	
	/**
	 * for FX 深超不良记录单
	 * @param printer
	 * @param str
	 */
	public void PrintForFXBLJL(final String printer ,final String str) {
		try {
			PrintFXBLJL printData = new PrintFXBLJL();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String mdlId = printData.getMdlId();
			String boxId = printData.getBoxId();
			String woId = printData.getWoId();
			String prdStdQty = printData.getPrdStdQty();
			String modelTotalCnt = printData.getModelTotalCnt();
			List<String> prdId = printData.getPrdAry();
			List<String> cFAry = printData.getcFAry();
			List<String> tFTAry = printData.gettFTAry();
			
			int loopCnt = (int) Math.ceil(stdQty / 40);
			
			PrintFX excel = new PrintFX("9",loopCnt,false,"ALL");
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				
				//第一行
		        HSSFCell cell = sheet.getRow(0).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(0).getCell(5);
		        cell.setCellValue(woId);
		        
		        //第二排
		        cell = sheet.getRow(1).getCell(1);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(1).getCell(3);
		        cell.setCellValue(prdStdQty);
		        cell = sheet.getRow(1).getCell(5);
		        cell.setCellValue(modelTotalCnt);
		        
				for (j = 0; j < 40; j++, index++) {
					if (index <= stdQty) {
				        if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+3).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						if(!Util.isEmptyString(cFAry.get(index - 1))){
							cell = sheet.getRow(j+3).getCell(2);
					        cell.setCellValue(cFAry.get(index - 1));
						}
						if(!Util.isEmptyString(tFTAry.get(index - 1))){
							cell = sheet.getRow(j+3).getCell(4);
					        cell.setCellValue(tFTAry.get(index - 1));
						}
					}
				}
			}
			
			FileOutputStream fileOut = new FileOutputStream("C:/FXBLJL.xls");  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,"C:/FXBLJL.xls");
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
}
